package com.fuze.energy.controller;

import com.fuze.energy.common.Result;
import com.fuze.energy.domain.dto.OzoneDTO;
import com.fuze.energy.service.OzoneService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@Api(tags = "臭氧API")
@Slf4j
@RestController
@RequiredArgsConstructor
public class OzoneController {
    @Autowired
    OzoneService ozoneService;


    @ApiOperation(value = "根据主板Id查询当前是否存在臭氧")
    @GetMapping("/ozo/current/{mainBoardId}")
    public Result currentOzo(@PathVariable(name = "mainBoardId") String mainBoardId) {
        Integer currentOzo = ozoneService.currentOzo(mainBoardId);
        return Result.ok(currentOzo);
    }

    @ApiOperation(value = "根据主板Id查看今日臭氧信息")
    @GetMapping("/ozo/today/{mainBoardId}")
    public Result todayOzo(@PathVariable(name = "mainBoardId") String mainBoardId) {
        List<OzoneDTO> result = ozoneService.todayOzo(mainBoardId);
        return Result.ok(result);
    }
}
